fix(detector-aws): extract full container ID from ECS Fargate cgroup #2855
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which problem is this PR solving?
AWS ECS Fargate changed their cgroup naming convention to
/ecs/<taskId>/<taskId>-<containerId>
format. The existing container ID extraction logic only takes the last 64 characters, causing truncation in the middle of the taskId and resulting in incomplete container IDs like438aa1824ca4058bdcab/c23e5f76c09d438aa1824ca4058bdcab-1234678
instead of the expected fullc23e5f76c09d438aa1824ca4058bdcab-1234678
.This breaks compatibility with observability vendors like DataDog that require the complete
taskId-containerId
format for proper container identification.Short description of the changes
_extractContainerIdFromLine()
method: Handles various container runtime formats (Docker, containerd, CRI-O) with proper prefix/suffix removal[a-zA-Z0-9\-_]+
to support real-world container ID formatsSupported formats:
/ecs/<taskId>/<taskId>-<containerId>
→taskId-containerId
/docker/containerid.scope
→containerid
system.slice:cri-containerd:containerid
→containerid
/uuid/34dc0b5e-626f-2c5c-4c51-70e34b10e765
→34dc0b5e-626f-2c5c-4c51-70e34b10e765
Fixes #2455